<template>
  <div>
  	<swiper :aspect-ratio='swiperRatio' :show-dots='false' class='swiper'>
      <swiper-item v-for='item in swiperImages' :key='swiperIndex' >
        <img v-bind:src='item.imageSrc' class='swiper_image'/>
        <img src='~assets/images/icon_ques_2x.png' class='icon_ques' @click='goToSchool'/>
        <img src='~assets/images/riskTip.png' class='risk_tip' @click='goToRisk'/>
      </swiper-item>
    </swiper>
  </div>
</template>

<script>
import { Swiper, SwiperItem } from '@/components/swiper'
import CommonUtil from '@/common/common.util'
export default {
  data () {
    return {
      swiperRatio: 0.4,
      swiperIndex: 1,
      swiperImages: [
        {imageSrc: require('assets/images/kv1_2x.jpg')}
      ]
    }
  },
  components: {
    Swiper,
    SwiperItem
  },
  methods: {
    goToSchool () {
      let tdId = this.isSharefunc() ? '004017' : '004003'
      this.maidian(tdId)
      this.$router.push({path: '/school'})
    },
    goToRisk () {
      let tdId = this.isSharefunc() ? '004019' : '004006'
      this.maidian(tdId)
      this.$router.push({path: '/warning'})
    },
    maidian (id) {
      // 埋点
      let TDAPP = window.TDAPP
      let usercode = CommonUtil.getUrlParam('userCode') || ''
      TDAPP.onEvent(id, '', {userCode: usercode})
      TDAPP.send()
    },
    isSharefunc () {
      let share = CommonUtil.getUrlParam('url')
      if (typeof (share) !== 'undefined') {
        return true
      } else {
        return false
      }
    }
  }
}
</script>

<style>
.swiper{
  width: 100%;
  height:auto;
}
.swiper_image{
  width: 100%;
}
.icon_ques{
  position: absolute;
  top:20px;
  width:36px;
  right:30px;
}
.risk_tip{
  width:314px;
  position: absolute;
  bottom:39px;
  left:218px;
}
</style>
